<template>
  <view class="content">
    <view class="top">选择常见原因<text class="iconfont icon-right" /></view>
    <textarea
      :disabled="disabled"
      class="textarea"
      v-model="remark"
      maxlength="300"
      placeholder="请输入内容"
      placeholder-class="placeholder"
    />
    <view class="textarea-num">{{ remark.length }}/300</view>

    <doubleButton v-if="!disabled" :leftText="'重置'" :rightText="'提交'" @doubleButtonClick="doubleButtonClick" />
  </view>
</template>

<script>
import doubleButton from "@/components/double-button/double-button.vue";
export default {
  components: {
    doubleButton,
  },
  data() {
    return {
      remark: "",
      disabled: false,
      options: ["太忙了", "催什么催啊，等一下不行吗？"],
    };
  },
  onShareAppMessage() {
    return this.$util.returnShareObj();
  },
  onLoad(options) {},
  methods: {
    fastInput(item) {
      if (this.remark.length + item.length > 100) {
        return;
      }
      if (this.remark.indexOf(item) > -1) {
        return;
      }
      if (this.remark) {
        this.remark = this.remark + "，"; //此处中文逗号
      }
      this.remark = this.remark + item;
    },
    doubleButtonClick(index) {
      if (index) {
        let pages = getCurrentPages(); //获取所有页面栈实例列表
        let prevPage = pages[pages.length - 2]; //上一页页面实例
        prevPage.$vm.getRemarkByBack(this.remark); //上一页请定义getRemarkByBack方法
        this.$util.goUrl(0);
      } else {
        this.remark = "";
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.content {
  background: $back-grey-color;
  padding: 28rpx;
  box-sizing: border-box;
  font-weight: 400;
  min-height: 100vh;
  .top {
    margin-bottom: 20rpx;
    color: $font-grey-color;
  }
  textarea {
    background: white;
    border-radius: 22rpx;
    box-sizing: border-box;
    height: 280rpx;
    width: 100%;
    padding: 20rpx;
  }
  .textarea-num {
    color: $font-grey-color;
    text-align: right;
  }
}
</style>
